package com.lwj.constant;

import com.lwj.service.common.file.FilePermission;
import com.lwj.service.common.file.FileServiceImpl;

import java.util.HashMap;
import java.util.Map;

public enum  FilePermissionEnum {
    HELP_ATTACHMENT("HELP_ATTACHMENT", FileServiceImpl.class)
    ;

    private final String code;
    private final Class<FilePermission> c;

    private static Map<String,Class<FilePermission>> classMap=new HashMap<>();

    static {
        FilePermissionEnum[] values = FilePermissionEnum.values();
        for (int i = 0; i < values.length; i++) {
            FilePermissionEnum entity = values[i];
            classMap.put(entity.code,entity.c);
        }
    }

    FilePermissionEnum(String code, Class c) {
        this.code = code;
        this.c = c;
    }

    public static Class<FilePermission> ofClass(String code){
        return classMap.get(code);
    }
}
